package com.yljk.homedoctor.adapter;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yljk.homedoctor.R;
import com.yljk.homedoctor.model.entity.HomeDoctorDetailEntity;

import java.util.List;

public class CommonAdapter extends BaseQuickAdapter<HomeDoctorDetailEntity.DataBean.DoctorPacketSetsListBean, BaseViewHolder> {
    public static boolean  isPrescriptionSupport ;

    public CommonAdapter(@Nullable List<HomeDoctorDetailEntity.DataBean.DoctorPacketSetsListBean> data) {
        super(R.layout.common_menu_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeDoctorDetailEntity.DataBean.DoctorPacketSetsListBean item) {
        helper.addOnClickListener(R.id.commomShare);
        helper.setText(R.id.commitName,item.getName());
//        String replace = item.getDiseaseList().toString().replace("[", "");
//        String replace1 = replace.replace("]", "");
//        String replace2 = replace1.replace("\"", "");
//        helper.setText(R.id.commitList,replace2);
        if (item.getImageUrl() == null || item.getImageUrl().equals("") || item.getImageUrl().isEmpty()){
            Glide.with(mContext).load(R.drawable.no_banner).transform(new CenterCrop()).into((ImageView) helper.getView(R.id.commitImg));
        }else{
            Glide.with(mContext).load(item.getImageUrl()).transform(new CenterCrop()).into((ImageView) helper.getView(R.id.commitImg));
        }
        if (isPrescriptionSupport){
            helper.setVisible(R.id.commomShare,true);
        }else{
            helper.setVisible(R.id.commomShare,false);

        }
    }
}
